<html>
<head><meta charset="utf-8"><title>Lints that require feature(..)? clippy#6953 clippy#6977 · clippy · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/index.html">clippy</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Lints.20that.20require.20feature(.2E.2E).3F.20clippy.236953.20clippy.236977.html">Lints that require feature(..)? clippy#6953 clippy#6977</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="231896269"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Lints%20that%20require%20feature%28..%29%3F%20clippy%236953%20clippy%236977/near/231896269" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Lints.20that.20require.20feature(.2E.2E).3F.20clippy.236953.20clippy.236977.html#231896269">(Mar 26 2021 at 00:17)</a>:</h4>
<p>I stumbled on an overzealous clippy lint today that wants me to use or patterns everywhere. While I would love to do just that, I'm running the latest stable version 1.51 and or patterns aren't set to stabilize until 1.53. Now I'm pretty sure this is a bug (<a href="https://github.com/rust-lang/rust-clippy/issues/6953">#6953</a>), but I'm curious more generally about the policy regarding lints that require feature flags. Personally, I think that lints should never make suggestions that require adding feature flags (even on a nightly compiler) unless the user has already added the feature flag. But I can also see an argument for using lints to discover unknown parts of the language, and for nightly users that might mean discovering new feature flags hot off the presses.</p>



<a name="231896744"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Lints%20that%20require%20feature%28..%29%3F%20clippy%236953%20clippy%236977/near/231896744" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Lints.20that.20require.20feature(.2E.2E).3F.20clippy.236953.20clippy.236977.html#231896744">(Mar 26 2021 at 00:22)</a>:</h4>
<p>(One reason not to draw conclusions from the compiler being a nightly is that a lot of people (most?) run clippy with a nightly even if they use stable for the actual build.)</p>



<a name="231898906"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Lints%20that%20require%20feature%28..%29%3F%20clippy%236953%20clippy%236977/near/231898906" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matthiaskrgr <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Lints.20that.20require.20feature(.2E.2E).3F.20clippy.236953.20clippy.236977.html#231898906">(Mar 26 2021 at 00:51)</a>:</h4>
<p>have you tried setting a <code>msrv</code> ?<br>
<a href="https://github.com/rust-lang/rust-clippy#specifying-the-minimum-supported-rust-version">https://github.com/rust-lang/rust-clippy#specifying-the-minimum-supported-rust-version</a></p>



<a name="231935844"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Lints%20that%20require%20feature%28..%29%3F%20clippy%236953%20clippy%236977/near/231935844" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> flip1995 <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Lints.20that.20require.20feature(.2E.2E).3F.20clippy.236953.20clippy.236977.html#231935844">(Mar 26 2021 at 09:33)</a>:</h4>
<p>I guess you are using nightly Clippy and stable rustc? We removed the check for the <code>or_patterns</code> feature a few days ago (in nightly only) because it is stable in 1.53.</p>
<p>Is there any reason, why you would run Clippy 1.53, but rustc 1.51?  We definitely appreciate that you are testing nightly Clippy for us and therefore help catch bugs early, but it is recommended to use the same Clippy version as rustc to gate on Clippy in CI. So, a setup which gates on stable Clippy, but also runs an allow-to-fail nightly Clippy to see the effects of new lints early / catch Clippy bugs is optimal.</p>
<p>Setting <code>msrv</code> is currently not possible for this lint. But we should add that to the lint.</p>



<a name="231938960"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Lints%20that%20require%20feature%28..%29%3F%20clippy%236953%20clippy%236977/near/231938960" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> flip1995 <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Lints.20that.20require.20feature(.2E.2E).3F.20clippy.236953.20clippy.236977.html#231938960">(Mar 26 2021 at 10:00)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust-clippy/issues/6977">clippy#6977</a></p>



<a name="232002805"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Lints%20that%20require%20feature%28..%29%3F%20clippy%236953%20clippy%236977/near/232002805" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Lints.20that.20require.20feature(.2E.2E).3F.20clippy.236953.20clippy.236977.html#232002805">(Mar 26 2021 at 17:22)</a>:</h4>
<blockquote>
<p>Is there any reason, why you would run Clippy 1.53, but rustc 1.51? We definitely appreciate that you are testing nightly Clippy for us and therefore help catch bugs early, but it is recommended to use the same Clippy version as rustc to gate on Clippy in CI.</p>
</blockquote>
<p>Ah, I see, I didn't know that clippy tracked rustc in this way. As you say, I run nightly clippy and stable rustc (this used to be the only way to do things, but even now it's useful to get the latest lints). Is there a way to set the msrv to "latest stable"?</p>



<a name="232003447"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Lints%20that%20require%20feature%28..%29%3F%20clippy%236953%20clippy%236977/near/232003447" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Lints.20that.20require.20feature(.2E.2E).3F.20clippy.236953.20clippy.236977.html#232003447">(Mar 26 2021 at 17:27)</a>:</h4>
<p>I'm probably confused about what tracks what, but it seems like clippy versions should be separate from rustc since most lints and lint changes apply to all rust versions, and I would hate to use a 12 week old clippy just so that I can track stable properly.</p>



<a name="232006768"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Lints%20that%20require%20feature%28..%29%3F%20clippy%236953%20clippy%236977/near/232006768" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> flip1995 <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Lints.20that.20require.20feature(.2E.2E).3F.20clippy.236953.20clippy.236977.html#232006768">(Mar 26 2021 at 17:49)</a>:</h4>
<blockquote>
<p>Is there a way to set the msrv to "latest stable"?</p>
</blockquote>
<p>Use stable Clippy <span aria-label="smiley" class="emoji emoji-1f603" role="img" title="smiley">:smiley:</span> No there isn't and there won't be, because using stable has this exact effect.</p>
<blockquote>
<p>clippy versions should be separate from rustc</p>
</blockquote>
<p>Clippy is shipped together with rustc. So it totally makes sense that Clippy tracks the rustc version. </p>
<blockquote>
<p>since most lints and lint changes apply to all rust versions</p>
</blockquote>
<p>Yes, but wouldn't we then have to backport everything to every version? There is a Clippy version (strictly tied to the rustc version) were a lint is added and it will be available from there on onwards. Just because a feature is added in Rust 1.98.0 it isn't magically available in Rust 1.0.0 either.</p>
<blockquote>
<p>and I would hate to use a 12 week old clippy just so that I can track stable properly.</p>
</blockquote>
<p>That's the same as saying: "I would hate to use a 12 week old <strong>rustc</strong> just so that I can track stable." If you want to use nightly Clippy, you're more than welcome to do so, since you'll help us find bugs in Clippy. But as with all nightly releases you will have to live with the consequences (i.e. bugs, unstable stuff, ...).</p>



<a name="232007842"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Lints%20that%20require%20feature%28..%29%3F%20clippy%236953%20clippy%236977/near/232007842" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Lints.20that.20require.20feature(.2E.2E).3F.20clippy.236953.20clippy.236977.html#232007842">(Mar 26 2021 at 17:57)</a>:</h4>
<blockquote>
<p>Yes, but wouldn't we then have to backport everything to every version?</p>
</blockquote>
<p>Isn't that what the msrv flag does?</p>



<a name="232007873"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Lints%20that%20require%20feature%28..%29%3F%20clippy%236953%20clippy%236977/near/232007873" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Lints.20that.20require.20feature(.2E.2E).3F.20clippy.236953.20clippy.236977.html#232007873">(Mar 26 2021 at 17:58)</a>:</h4>
<p>I don't think of it as backporting, but rather that certain lints only apply to certain versions</p>



<a name="232007966"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Lints%20that%20require%20feature%28..%29%3F%20clippy%236953%20clippy%236977/near/232007966" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Lints.20that.20require.20feature(.2E.2E).3F.20clippy.236953.20clippy.236977.html#232007966">(Mar 26 2021 at 17:58)</a>:</h4>
<p>backporting would be adding features to stable clippy</p>



<a name="232008122"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Lints%20that%20require%20feature%28..%29%3F%20clippy%236953%20clippy%236977/near/232008122" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Lints.20that.20require.20feature(.2E.2E).3F.20clippy.236953.20clippy.236977.html#232008122">(Mar 26 2021 at 17:59)</a>:</h4>
<p>In the or_patterns situation, would it not make sense to just enable it on stable in ~12 weeks?</p>



<a name="232008299"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Lints%20that%20require%20feature%28..%29%3F%20clippy%236953%20clippy%236977/near/232008299" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Lints.20that.20require.20feature(.2E.2E).3F.20clippy.236953.20clippy.236977.html#232008299">(Mar 26 2021 at 18:00)</a>:</h4>
<p>1.53 stable is not really a thing that exists yet</p>



<a name="232009136"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Lints%20that%20require%20feature%28..%29%3F%20clippy%236953%20clippy%236977/near/232009136" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> flip1995 <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Lints.20that.20require.20feature(.2E.2E).3F.20clippy.236953.20clippy.236977.html#232009136">(Mar 26 2021 at 18:06)</a>:</h4>
<p>Yes, it will be enabled in stable 1.53 in 12 weeks. Currently it is only enabled on 1.53 nightly, not on any stable release of Clippy.</p>



<a name="232009362"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Lints%20that%20require%20feature%28..%29%3F%20clippy%236953%20clippy%236977/near/232009362" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> flip1995 <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Lints.20that.20require.20feature(.2E.2E).3F.20clippy.236953.20clippy.236977.html#232009362">(Mar 26 2021 at 18:08)</a>:</h4>
<p>But as every feature, in order to get into stable, it first has to be in nightly and then beta. </p>
<p>You are using <strong>nightly</strong> Clippy 1.53. <strong>Not</strong> stable Clippy 1.53. So you get all the features that are enabled in the current nightly and will be available in stable in 12 weeks.</p>



<a name="232014926"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Lints%20that%20require%20feature%28..%29%3F%20clippy%236953%20clippy%236977/near/232014926" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Lints.20that.20require.20feature(.2E.2E).3F.20clippy.236953.20clippy.236977.html#232014926">(Mar 26 2021 at 18:53)</a>:</h4>
<p>I see, this makes sense. Is there a difference between nightly clippy 1.53 and stable clippy 1.53 (as in something that clippy itself can detect and do differently)? Or is it just that in a few weeks you will be changing the program itself to work on the stable channel. Because what I would like to do is configure nightly clippy to act like stable, without actually using an old version. Am I asking for <code>RUSTC_BOOTSTRAP</code>? I'm not sure.</p>



<a name="232017737"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Lints%20that%20require%20feature%28..%29%3F%20clippy%236953%20clippy%236977/near/232017737" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> flip1995 <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Lints.20that.20require.20feature(.2E.2E).3F.20clippy.236953.20clippy.236977.html#232017737">(Mar 26 2021 at 19:13)</a>:</h4>
<p>stable Clippy 1.53 will be released with stable Rust 1.53 and there are no guarantees that features from nightly Clippy 1.53 will be in stable Clippy 1.53.  Nightly releases are inherently unstable with no guarantees. You can't magically make a nightly release behave like a stable release. <code>RUSTC_BOOTSTRAP</code> makes a stable release behave like a unstable nightly. This env var is inherently unstable and you should not use it ever.</p>
<p>If there is confusion what a nightly build is, I recommend reading the <a href="https://en.wikipedia.org/wiki/Daily_build">Wikipedia article</a> about it. It is really short.</p>



<a name="232018881"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Lints%20that%20require%20feature%28..%29%3F%20clippy%236953%20clippy%236977/near/232018881" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Lints.20that.20require.20feature(.2E.2E).3F.20clippy.236953.20clippy.236977.html#232018881">(Mar 26 2021 at 19:22)</a>:</h4>
<p>I think, rather than "stable", a better term for what I'm looking for is "nightly but with no <code>feature(..)</code>"</p>



<a name="232019122"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Lints%20that%20require%20feature%28..%29%3F%20clippy%236953%20clippy%236977/near/232019122" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Lints.20that.20require.20feature(.2E.2E).3F.20clippy.236953.20clippy.236977.html#232019122">(Mar 26 2021 at 19:24)</a>:</h4>
<p>It is unfortunate that these two things are intermingled in rustc - there is a difference between wanting the version of the master branch that was compiled last night and wanting experimental features</p>



<a name="232020071"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Lints%20that%20require%20feature%28..%29%3F%20clippy%236953%20clippy%236977/near/232020071" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Lints.20that.20require.20feature(.2E.2E).3F.20clippy.236953.20clippy.236977.html#232020071">(Mar 26 2021 at 19:32)</a>:</h4>
<blockquote>
<p>We definitely appreciate that you are testing nightly Clippy for us and therefore help catch bugs early, but it is recommended to use the same Clippy version as rustc to gate on Clippy in CI. So, a setup which gates on stable Clippy, but also runs an allow-to-fail nightly Clippy to see the effects of new lints early / catch Clippy bugs is optimal.</p>
</blockquote>
<p>If I did this, wouldn't the nightly Clippy fail now and for the next 12 weeks? It sounds like you are saying this is "working as intended" but I'm missing some configuration option so that an unfixable error doesn't linger.</p>



<a name="232020179"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Lints%20that%20require%20feature%28..%29%3F%20clippy%236953%20clippy%236977/near/232020179" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> flip1995 <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Lints.20that.20require.20feature(.2E.2E).3F.20clippy.236953.20clippy.236977.html#232020179">(Mar 26 2021 at 19:33)</a>:</h4>
<p><code>or_patterns</code> is/will be stable in 1.53. So Clippy 1.53 will treat it as stable. Clippy won't just enable features.</p>



<a name="232020223"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Lints%20that%20require%20feature%28..%29%3F%20clippy%236953%20clippy%236977/near/232020223" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> flip1995 <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Lints.20that.20require.20feature(.2E.2E).3F.20clippy.236953.20clippy.236977.html#232020223">(Mar 26 2021 at 19:33)</a>:</h4>
<p>Clippy 1.52. and earlier doesn't treat <code>or_patterns</code> as stable. This is just basic versioning.</p>



<a name="232020268"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Lints%20that%20require%20feature%28..%29%3F%20clippy%236953%20clippy%236977/near/232020268" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Lints.20that.20require.20feature(.2E.2E).3F.20clippy.236953.20clippy.236977.html#232020268">(Mar 26 2021 at 19:34)</a>:</h4>
<p>but you are saying that nightly clippy doesn't know my project is stable</p>



<a name="232020326"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Lints%20that%20require%20feature%28..%29%3F%20clippy%236953%20clippy%236977/near/232020326" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Lints.20that.20require.20feature(.2E.2E).3F.20clippy.236953.20clippy.236977.html#232020326">(Mar 26 2021 at 19:34)</a>:</h4>
<p>which makes sense, there isn't anywhere obvious that I have indicated as much</p>



<a name="232020390"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Lints%20that%20require%20feature%28..%29%3F%20clippy%236953%20clippy%236977/near/232020390" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Lints.20that.20require.20feature(.2E.2E).3F.20clippy.236953.20clippy.236977.html#232020390">(Mar 26 2021 at 19:35)</a>:</h4>
<p>With rustc, I can get more or less the same behavior on stable and nightly by simply not using feature flags. But nightly clippy here is behaving quite differently from stable clippy even without any flags</p>



<a name="232020418"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Lints%20that%20require%20feature%28..%29%3F%20clippy%236953%20clippy%236977/near/232020418" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> flip1995 <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Lints.20that.20require.20feature(.2E.2E).3F.20clippy.236953.20clippy.236977.html#232020418">(Mar 26 2021 at 19:35)</a>:</h4>
<p>It doesn't. When you compile your project with a compiler with version 1.53., the compiler assumes that your project is compatible with compiler version 1.53. Clippy is not much different from a compiler.</p>



<a name="232020562"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Lints%20that%20require%20feature%28..%29%3F%20clippy%236953%20clippy%236977/near/232020562" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> flip1995 <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Lints.20that.20require.20feature(.2E.2E).3F.20clippy.236953.20clippy.236977.html#232020562">(Mar 26 2021 at 19:36)</a>:</h4>
<p>If rustc adds a warning in 1.53 (nightly). you will get that warning when you use nightly rustc, but not when you use stable rustc, because the warning was not there in stable rustc.</p>



<a name="232020624"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Lints%20that%20require%20feature%28..%29%3F%20clippy%236953%20clippy%236977/near/232020624" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> flip1995 <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Lints.20that.20require.20feature(.2E.2E).3F.20clippy.236953.20clippy.236977.html#232020624">(Mar 26 2021 at 19:37)</a>:</h4>
<p>You may not notice this with rustc, because it only rarely happens nowadays. But Clippy is by design changing more and faster.</p>



<a name="232020715"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Lints%20that%20require%20feature%28..%29%3F%20clippy%236953%20clippy%236977/near/232020715" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Lints.20that.20require.20feature(.2E.2E).3F.20clippy.236953.20clippy.236977.html#232020715">(Mar 26 2021 at 19:38)</a>:</h4>
<p>The or pattern example was something like a project with</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">match</span><span class="w"> </span><span class="nb">Some</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="nb">Some</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="nb">Some</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="p">{}</span><span class="w"></span>
<span class="w">        </span><span class="n">_</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="p">{}</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>
<p>which clippy was suggesting to change to</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="cp">#[feature(or_patterns)]</span><span class="w"></span>
<span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">match</span><span class="w"> </span><span class="nb">Some</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="nb">Some</span><span class="p">(</span><span class="mi">1</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="mi">2</span><span class="p">)</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="p">{}</span><span class="w"></span>
<span class="w">        </span><span class="n">_</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="p">{}</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>
<p>So clippy clearly recognizes that the feature flag (1) is not present and (2) needs to be added to make the suggestion compile. The exact same code run on stable clippy would presumably not make the suggestion</p>



<a name="232020739"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Lints%20that%20require%20feature%28..%29%3F%20clippy%236953%20clippy%236977/near/232020739" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> flip1995 <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Lints.20that.20require.20feature(.2E.2E).3F.20clippy.236953.20clippy.236977.html#232020739">(Mar 26 2021 at 19:38)</a>:</h4>
<blockquote>
<p>If I did this, wouldn't the nightly Clippy fail now and for the next 12 weeks?</p>
</blockquote>
<p>Yes, that is why we don't recommend to gate on nightly Clippy on your CI. You can use nightly Clippy <strong>in addition</strong> to get an early warning for new Clippy features.</p>



<a name="232020856"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Lints%20that%20require%20feature%28..%29%3F%20clippy%236953%20clippy%236977/near/232020856" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> flip1995 <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Lints.20that.20require.20feature(.2E.2E).3F.20clippy.236953.20clippy.236977.html#232020856">(Mar 26 2021 at 19:39)</a>:</h4>
<p>Clippy does not suggest that you should add a feature flag.</p>



<a name="232021332"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Lints%20that%20require%20feature%28..%29%3F%20clippy%236953%20clippy%236977/near/232021332" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> flip1995 <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Lints.20that.20require.20feature(.2E.2E).3F.20clippy.236953.20clippy.236977.html#232021332">(Mar 26 2021 at 19:43)</a>:</h4>
<blockquote>
<p>The exact same code run on stable clippy would presumably not make the suggestion</p>
</blockquote>
<p>Yes, because the feature isn't stable on current stable, yet.</p>



<a name="232021528"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Lints%20that%20require%20feature%28..%29%3F%20clippy%236953%20clippy%236977/near/232021528" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> flip1995 <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Lints.20that.20require.20feature(.2E.2E).3F.20clippy.236953.20clippy.236977.html#232021528">(Mar 26 2021 at 19:45)</a>:</h4>
<p>So if you would use the same Version of Clippy as you do for rustc, you would not have this problem. You can't use 2 different versions of obviously equivalent versioned programs and expect that they're 100% compatible.</p>



<a name="232021567"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Lints%20that%20require%20feature%28..%29%3F%20clippy%236953%20clippy%236977/near/232021567" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Lints.20that.20require.20feature(.2E.2E).3F.20clippy.236953.20clippy.236977.html#232021567">(Mar 26 2021 at 19:45)</a>:</h4>
<p>Right, my question is how does stable clippy know it is not nightly?</p>



<a name="232021731"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Lints%20that%20require%20feature%28..%29%3F%20clippy%236953%20clippy%236977/near/232021731" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Lints.20that.20require.20feature(.2E.2E).3F.20clippy.236953.20clippy.236977.html#232021731">(Mar 26 2021 at 19:46)</a>:</h4>
<p>There have to be some configuration settings that change when the channel changes</p>



<a name="232022084"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Lints%20that%20require%20feature%28..%29%3F%20clippy%236953%20clippy%236977/near/232022084" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> flip1995 <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Lints.20that.20require.20feature(.2E.2E).3F.20clippy.236953.20clippy.236977.html#232022084">(Mar 26 2021 at 19:48)</a>:</h4>
<p>It doesn't have to. Features are added in a specific version. They will be stable once that version becomes stable. </p>
<p>Stable Clippy is at commit XXX (oldest)<br>
Beta Clippy is at commit YYY<br>
Nightly Clippy is at commit ZZZ (newest)</p>
<p>There is no check whatsoever in Clippy that checks if it is a nightly build. (Well, there were in some versions before, but those are implementation details that have nothing to do with this)</p>



<a name="232022110"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Lints%20that%20require%20feature%28..%29%3F%20clippy%236953%20clippy%236977/near/232022110" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Lints.20that.20require.20feature(.2E.2E).3F.20clippy.236953.20clippy.236977.html#232022110">(Mar 26 2021 at 19:49)</a>:</h4>
<blockquote>
<p>Clippy does not suggest that you should add a feature flag.</p>
</blockquote>
<p>Hm, I could have sworn it suggested that, but I just tested it and indeed it doesn't mention the flag. (That does mean it's making suggestions that don't compile, even on nightly, though)</p>



<a name="232022349"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Lints%20that%20require%20feature%28..%29%3F%20clippy%236953%20clippy%236977/near/232022349" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Lints.20that.20require.20feature(.2E.2E).3F.20clippy.236953.20clippy.236977.html#232022349">(Mar 26 2021 at 19:50)</a>:</h4>
<p>So that means that for any stable, there was once a nightly that was identical to that stable, right? Did that nightly suggest experimental features?</p>



<a name="232022641"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Lints%20that%20require%20feature%28..%29%3F%20clippy%236953%20clippy%236977/near/232022641" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> flip1995 <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Lints.20that.20require.20feature(.2E.2E).3F.20clippy.236953.20clippy.236977.html#232022641">(Mar 26 2021 at 19:52)</a>:</h4>
<blockquote>
<p>So that means that for any stable, there was once a nightly that was identical to that stable</p>
</blockquote>
<p>I guess you can say it like this, yes.</p>
<blockquote>
<p>Did that nightly suggest experimental features?</p>
</blockquote>
<p>If it did and it got reported, that was fixed before the nightly was turned into stable.</p>



<a name="232023117"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Lints%20that%20require%20feature%28..%29%3F%20clippy%236953%20clippy%236977/near/232023117" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Lints.20that.20require.20feature(.2E.2E).3F.20clippy.236953.20clippy.236977.html#232023117">(Mar 26 2021 at 19:56)</a>:</h4>
<p>Then that means that any lints about long-term unstable features is getting removed and added back every 6 weeks?</p>



<a name="232023548"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Lints%20that%20require%20feature%28..%29%3F%20clippy%236953%20clippy%236977/near/232023548" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> flip1995 <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Lints.20that.20require.20feature(.2E.2E).3F.20clippy.236953.20clippy.236977.html#232023548">(Mar 26 2021 at 19:59)</a>:</h4>
<p>No the gating of this features in the lint implementation just doesn't get removed. E.g. <a href="https://github.com/rust-lang/rust/commit/5cb8f92791432634a172740d8aca2ceae12c3e58#diff-0383bd8ec65ec80cd839f5b43f1cb86fc404fbb698f39fbfb6638f10ff5a9e77">this commit</a> removed the gate for the <code>or_patterns</code> feature during stabilization.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>